<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/model_resp.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/js/web/consultant_ask_spcode.js"></script>
</head>
<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>资源统计管理</li>
			<li>&gt;</li>
			<li class="current">批量分配</li>
		</ul>
	</div>
	<div id="caption">
		<ul>
			<li><span class="title">操作提示：</span></li>
			<li>Ctrl+Enter 提交</li>
		</ul>
	</div>
	<div id="container">
		<div id="title"></div>
		<table id="tbl_spcode">
			<tr>
				<th>客户昵称</th>
				<td>
					<#if jsVotes??>
						<#list jsVotes as list>
							<span id="sp_date" class="unit hand">
								${list.lianxi_name}
							</span>
						</#list>
					</#if>
				</td>
			</tr>
			<tr>
				<th width="25%">目标咨询师</th>
				<td width="75%">
					<select id="zxs_name">
						<option value="">-- 请选择目标 --</option>
						<#if uList_1??>
							<#list uList_1 as list>
								<option value="${list.username}">${list.nickname}（${list.regions}-${list.departments}-${list.job}）</option>
							</#list>
						</#if>
						<#if uList_2??>
							<#list uList_2 as list>
								<option value="${list.username}">${list.nickname}（${list.regions}-${list.departments}-${list.job}）</option>
							</#list>
						</#if>
					</select>
					<input type="text" id="sp_user_ipt" size="12" maxlength="10" placeholder="输入快捷匹配">
					
					<p class="line"></p>
					<p class="caption">将该问卷所属的客户资源分配给指定的咨询师进行后续业务跟进，该操作不可撤消且只能进行一次</p>
				</td>
			</tr>
		</table>
		<div class="remark">
		</div>
		<div id="controlbar">
			<input id="" onclick="sub_plfp('${ids}')" type="button" class="submit" value="  提交分配方案  " />
			<input id="btnCancel" type="button" class="submit" value="  返回列表  " onclick="history.back()" />
		</div>
	</div>
	
	<script>
		/**
		* 提交分配方案
		*/
		function sub_plfp(ids){
			var zxs_name = $('#zxs_name').val();
			if(zxs_name == ""){
				alert("请选择目标咨询师！");
				return false;
			}
			$.ajax({
        		type: "post",
        		url: "${contextPath}/consu/import_plfp.json",
        		data: {ids:ids,zxs_name:zxs_name },
       		 	dataType: "json",
        		success: function(data){
        			if(data == true){
        				alert("分配成功");
        			}else{
        				alert(data);
        			}
        		}
   		 	});
		}
		
		/**
		* 快速匹配事件（搜索）
		*/
		$(function(){
			$("#sp_user_ipt").change(function(){
				var nickname = $("#sp_user_ipt").val();
				$.post("${contextPath}/admin/getUserBynickname.json", {
					"nickname" : nickname
					}, function(ms) {
					if(ms.user!=null){
			 			//var username = ms.user.nickname;
			 			var objHtml ='<option value="'+ms.user.username+'">'+ms.user.nickname+'（'+ms.user.regions+'-'+ms.user.jobns+'-'+ms.user.job+'）</option>';
						$("#zxs_name").html('<select id="zxs_name">'+objHtml+'</select>');
			 		}
				});
			});
		});
	</script>
</body>
</html>